

package ejb.ebank.entities;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;



/**
 * class represents single operation
 * @author piotrek
 *
 */

@Entity
public class Operation implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8070255953738914557L;
	
	private long id;
	private OperationClient sender;
	private OperationClient receiver;
	private Timestamp startDate;
	private Timestamp approveDate;
	private OperationType operationKind;
	private double amount;
	
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public long getId() {
		return id;
	}
	
	public void setId(long id) {
		this.id = id;
	}
	
	public OperationClient getSender() {
		return sender;
	}
	
	public void setSender(OperationClient sender) {
		this.sender = sender;
	}
	
	public OperationClient getReceiver() {
		return receiver;
	}
	
	public void setReceiver(OperationClient receiver) {
		this.receiver = receiver;
	}
	
	public Timestamp getStartDate() {
		return startDate;
	}
	
	public void setStartDate(Timestamp startDate) {
		this.startDate = startDate;
	}
	
	public Timestamp getApproveDate() {
		return approveDate;
	}
	
	public void setApproveDate(Timestamp approveDate) {
		this.approveDate = approveDate;
	}
	
	@OneToOne(cascade={CascadeType.ALL})
	public OperationType getOperationKind() {
		return operationKind;
	}
	
	public void setOperationKind(OperationType operationKind) {
		this.operationKind = operationKind;
	}
	
	public double getAmount() {
		return amount;
	}
	
	public void setAmount(double amount) {
		this.amount = amount;
	}
	
}
